<template>
  <div>
    <div class="title">热销推荐</div>
    <ul>
        <router-link  tag="li" class="item" border-bottom v-for="item of list" :key="item.id" :to="'/detail/' + item.id">
          <img class="item-img" :src="item.imgUrl">
          <div class="item-info">
            <p class="item-title">{{item.title}}</p>
            <p class="item-desc">{{item.desc}}</p>
            <button class="item-button">查看详情</button>
          </div>
        </router-link>
    </ul>
  </div>
</template>

<script>
export default {
  name: 'HomeRecommend',
  props: {
    list: Array
  }
}
</script>

<style scoped lang="stylus">
  @import '~styles/mixins.styl'
  .item-info >>> p {
    margin-block-start: -.2em;
    margin-block-end: -.5em;
  }
  ul {
    margin:0
    padding:0
  }
.title {
  margin-top:.5rem
  line-height:1.5rem
  background: #eee
  text-indent:.5rem
}
  .item {
    overflow:hidden
    display:flex
    height:4rem
  }
  .item-img {
    width:3.8rem
    height:3.8rem
    padding:.2rem
  }
  .item-info {
    flex:1     //会自动撑开盒子的宽度
    padding:.2rem
    min-width :0
  }
  .item-title {
    line-height:1.5rem
    font-size:.64rem
    ellipsis()
  }
  .item-desc {
    line-height:1.5rem
    font-size:.32rem
    color:#ccc
    ellipsis()
  }
  .item-button {
    background: #ff9300
    padding:0 .2rem
    border:none
    border-radius :.2rem
    height:1.3rem
    color:#fff
    height:1.3rem
    font-size:.28rem
  }
</style>
